import sys
from pyswmm import Simulation, Output
from swmm.toolkit.shared_enum import NodeAttribute
from datetime import datetime, timedelta

# 处理传递的参数
two = sys.argv[1]
# 读取数据结果
out = Output(two)
out.open()
dicts = {}
series = out.node_series(out.nodes[sys.argv[2]], NodeAttribute.HYDRAULIC_HEAD)
converted_dict = {(key.replace(minute=0, second=0) + timedelta(hours=1)).strftime('%Y-%m-%d %H:%M'): value for key, value in series.items()}
converted_dict2 = {"shuiwei": converted_dict}

series2 = out.node_series(out.nodes[sys.argv[2]], NodeAttribute.TOTAL_INFLOW)
converted_dict3 = {(key.replace(minute=0, second=0) + timedelta(hours=1)).strftime('%Y-%m-%d %H:%M'): value for key, value in series2.items()}
converted_dict4 = {"liuliang": converted_dict3}

dicts= {**converted_dict2, **converted_dict4}
print(dicts)






